#ifndef IFCONFIG_H
#define IFCONFIG_H

#include <string>

#include <net/if.h>

#include <inttypes.h>

namespace usnet {
struct Ifconfig {
    Ifconfig() = default;
    Ifconfig(
        const std::string& ifname,
        const uint32_t& flags,
        const uint32_t& mtu):
        ifname_ { ifname },
        ifindex_ { if_nametoindex(ifname_.c_str()) },
        flags_ { flags },
        mtu_ { mtu }
    {
        // nothing to do
    }

    const std::string ifname_ { };
    const uint32_t ifindex_ { };
    const uint32_t flags_ { };
    const uint32_t mtu_ { };
    struct {
        uint32_t ip4_ { };
        uint32_t ip4_netmask_ { };
        uint32_t ip4_broadcast_ { };
        uint8_t  ip6_[16] { };
        uint32_t prefixlen_ { };
        uint32_t scopeid_ { };
    } net_addr_ { };
    uint8_t eth_addr_[6] { };
    uint32_t txqlen_ { };
};
}
#endif